Panthor with 1GHz frequency#380
Merged
igorpecovnik merged 4 commits intoarmbian:rk-6.1-rkr5.1from Aug 11, 2025
Merged
Conversation
|
thoroughly tested and works on my 3588 |
Add support for a bus clock for rockchip,rk3588-mali compatible. Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
On RK3588 the GPU clk is exposed using a normal CLK_GPU and also as SCMI_CLK_GPU. The main clock for the GPU is the SCMI_CLK_GPU, however, the normal CLK_GPU also need to be enabled independently. Add support for a bus clk to handle these two different clocks, similar to panfrost. Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
CLK_GPU is the main clock for the GPU on RK3588, it's typical source
pll can be one of gpll, cpll, aupll, npll or spll. For higher clock
rates it is also possible to use the gpu pvtpll as pll source.
The logic to switch between a normal pll and the pvtpll depending on
rate is handled in TF-A firmware, and exposed to Linux as a scmi clock.
TF-A will typically change to use normal pll for rates up to 200 MHz and
use pvtpll for 300 MHz or more.
Change to use the SCMI_CLK_GPU as the main GPU clock and add the normal
CLK_GPU as a bus clk to model this in a similar way as on RK356x.
Prior to this change the GPU clk rate was max 850 MHz:
$ glmark2-es2-gbm -b terrain
[...]
GL_VENDOR: Mesa
GL_RENDERER: Mali-G610 (Panfrost)
GL_VERSION: OpenGL ES 3.1 Mesa 25.0.4
Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=24 stencil=0 samples=0
Surface Size: 800x600 fullscreen
[...]
[terrain] <default>: FPS: 139 FrameTime: 7.231 ms
After this the GPU clk rate can use the 1 GHz rate with PVTPLL:
[terrain] <default>: FPS: 152 FrameTime: 6.579 ms
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
On Rockchip RK3588 trying to change the SCMI_CLK_GPU rate when the GPU device is PM runtime suspended may cause a kernel panic: $ echo 1000000000 > /sys/class/devfreq/fb000000.gpu/min_freq SError Interrupt on CPU4, code 0x00000000be000411 -- SError CPU: 4 UID: 0 PID: 241 Comm: sh Not tainted 6.15.0-rc3 armbian#1 VOLUNTARY Hardware name: Radxa ROCK 5B (DT) pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : smc_send_message+0x140/0x148 lr : smc_send_message+0xd8/0x148 sp : ffff8000827138c0 x29: ffff8000827138c0 x28: ffff000008764000 x27: 0000000000000000 x26: 0000000000000000 x25: 00000000ffffffff x24: ffff800082713b28 x23: ffff00000696b010 x22: ffff000003db4da0 x21: ffff000003fdae80 x20: ffff0000053f22c0 x19: ffff000003db4d80 x18: 0000000000000000 x17: 0000000000000000 x16: 0000000000000000 x15: 00000000245df550 x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000 x11: 0000000000000040 x10: ffff000003fde138 x9 : ffff000003fde130 x8 : ffff000005e5c948 x7 : 0000000000000000 x6 : 0000000000000000 x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000 x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000000000000000 Kernel panic - not syncing: Asynchronous SError Interrupt CPU: 4 UID: 0 PID: 241 Comm: sh Not tainted 6.15.0-rc3 armbian#1 VOLUNTARY Hardware name: Radxa ROCK 5B (DT) Call trace: show_stack+0x28/0x78 (C) dump_stack_lvl+0x58/0x74 dump_stack+0x14/0x1c panic+0x14c/0x328 add_taint+0x0/0xc0 arm64_serror_panic+0x60/0x6c do_serror+0x24/0x60 el1h_64_error_handler+0x2c/0x40 el1h_64_error+0x6c/0x70 smc_send_message+0x140/0x148 (P) do_xfer+0xb0/0x1f8 scmi_clock_rate_set+0xc0/0x220 scmi_clk_set_rate+0x24/0x38 clk_change_rate+0x164/0x288 clk_core_set_rate_nolock+0x1dc/0x314 clk_set_rate+0x34/0x144 _opp_config_clk_single+0x2c/0x90 _set_opp+0x104/0x564 dev_pm_opp_set_rate+0x110/0x260 panthor_devfreq_target+0x38/0x60 [panthor] devfreq_set_target+0x84/0x180 devfreq_update_target+0xb4/0xcc update_devfreq+0x10/0x18 set_freq_store+0x6c/0xb4 dev_attr_store+0x14/0x24 sysfs_kf_write+0x54/0x60 kernfs_fop_write_iter+0x118/0x1e0 vfs_write+0x224/0x390 ksys_write+0x68/0x100 __arm64_sys_write+0x18/0x20 invoke_syscall+0x44/0x100 el0_svc_common.constprop.0+0x3c/0xe0 do_el0_svc+0x18/0x20 el0_svc+0x2c/0xc0 el0t_64_sync_handler+0x104/0x130 el0t_64_sync+0x170/0x174 SMP: stopping secondary CPUs Kernel Offset: disabled CPU features: 0x0e00,000000e0,01202650,8201700b Memory Limit: 3838 MB ---[ end Kernel panic - not syncing: Asynchronous SError Interrupt ]--- This typically happen when CLK_GPU is disabled or when PD_GPU is down. Add a config_clks ops that will not set core clk rate when the device is PM runtime suspended. Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
5262d50 to
a6ff938
Compare
HeyMeco
approved these changes
Aug 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Kwiboo's patches backported to BSP kernel, though I've only included the rk3588 part for now.